package com.dingqb.ktdemo.oop.data

data class User(var name: String, var age: Int)

fun main(arg: Array<String>) {

	var tom = User("Tom", 22);
	var cp = tom.copy(age = 122, name = "cptom");
	//cp.name = "cpTopm";
	println(tom.toString());
	println(cp.toString());
	println(cp.name);
	var t5 = User("Tom", 22);
	var (name, age) = cp;
	print(age.toString() + "-");
	println(name);


	doParse(123);
	doParse(123.toDouble());
	doParse(123.toLong());
	doParse("123");
}

fun <T> doParse(t: T) {
	when (t) {
		is Int -> print("int ");
		is Double -> print("double ");
		is Long -> print("long  ");
		is String -> print("string  ");
	}
}


